package cn.ym.ymcc.fallback;

import cn.ym.ymcc.feign.CourseServerFeign;

import cn.ym.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignFallbackFactory implements FallbackFactory<CourseServerFeign> {


    @Override
    public CourseServerFeign create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseServerFeign() {


            @Override
            public JSONResult getCourseMarketById(Long id) {
                return JSONResult.error("系统繁忙，请稍后再试！！！");
            }

            @Override
            public JSONResult getCourseUserLearnByCourseId(Long courseId) {
                return JSONResult.error("系统繁忙，请稍后再试！！！");
            }

            @Override
            public JSONResult getCourseByCourseId(Long id) {
                return JSONResult.error("系统繁忙，请稍后再试！！！");
            }

            @Override
            public JSONResult info(String courseId) {
                return JSONResult.error("系统繁忙，请稍后再试！！！");
            }
        };
    }
}
